<template>
  <div class="common-layout">
    <el-container>
      <el-container>
        <el-aside width="300">
          <vxe-grid ref="taskListGrid" v-bind="gridOptions1" size="mini" @current-change="currentChangeEvent">
            <template #toolbar_buttons>
              <vxe-button @click="getTaskList">刷新</vxe-button>
              <vxe-button @click="newtask">新建</vxe-button>
              <vxe-button @click="gridOptions1.align = 'right'">删除</vxe-button>
            </template>
          </vxe-grid>
        </el-aside>
        <el-container>
          <el-main style="padding: 0px 20px !important;height: auto">
            <vxe-form :data="form" title-align="right" title-width="100" size="mini">
              <vxe-form-item title="基本信息" title-align="left" :title-width="200" :span="24"
                             :title-prefix="{icon: 'fa fa-address-card-o'}"><vxe-button style="float: right" @click="dotaskTest">测试</vxe-button>
              </vxe-form-item>
              <vxe-form-item field="name" title="名称" :span="8" :item-render="{}">
                <template #default="{ data }">
                  <vxe-input v-model="data.name" placeholder="请输入名称"></vxe-input>
                </template>
              </vxe-form-item>
              <vxe-form-item title="启用" field="isActive" span="6"
                             :item-render="{name: '$switch', props:{openLabel:'是',openValue:1,closeLabel:'否',closeValue:0}}"
                             title-overflow="ellipsis"></vxe-form-item>
              <vxe-form-item field="cron" title="执行时机" :span="8" :item-render="{}">
                <template #default="{ data }">
                  <vxe-input v-model="data.cron" placeholder="请输入Cron表达式"></vxe-input>
                </template>
              </vxe-form-item>
              <vxe-form-item field="type" title="任务类型" :span="24" :item-render="{}">
                <template #default="{ data }">
                  <vxe-radio-group v-model="data.type">
                    <vxe-radio label="A" content="自动填报"></vxe-radio>
                    <vxe-radio label="B" content="数据库作业"></vxe-radio>
                    <vxe-radio label="C" content="表单外部审核"></vxe-radio>
                    <vxe-radio label="D" content="预警通知"></vxe-radio>
                  </vxe-radio-group>
                </template>
              </vxe-form-item>
            </vxe-form>
            <div>


              <el-tabs type="border-card" v-model="activeName">

                <el-tab-pane label="模板设置" name="A" v-if="form.type!=='D'">

                  <vxe-form :data="form" title-align="right" title-width="100" size="mini">
                    <vxe-form-item title="选择模板" field="ext.template" :item-render="{}" span="24">
                      <template #default="{ data }">

                        <el-select v-model="data.ext.template" filterable clearable placeholder="选择模板" multiple>
                          <el-option
                              v-for="item in templates"
                              :key="item.id"
                              :label="item.title"
                              :value="item.code"
                          />
                        </el-select>


                      </template>
                    </vxe-form-item>
                    <vxe-form-item title="执行人员" field="ext.userid" :item-render="{}" span="24">
                      <template #default="{ data }">
                        <vxe-select v-model="data.ext.userid" placeholder="请选择人员" clearable transfer>
                          <vxe-option v-for="item in users" :key="item.id" :value="item.id"
                                      :label="item.userName"></vxe-option>
                        </vxe-select>
                      </template>
                    </vxe-form-item>

                  </vxe-form>
                </el-tab-pane>
                <el-tab-pane label="设置数据来源" name="B" v-if="form.type==='C'">
                  <el-row>
                    <el-col :span="16">
                      <vxe-form :data="form" title-align="right" title-width="100" size="mini">
                        <vxe-form-item field="ext.fromDB" :item-render="{defaultValue:''}" title="来源数据库" span="10">
                          <template #default="{ data }">
                            <vxe-select v-model="data.ext.fromDB" transfer>
                              <vxe-option v-for="item in DB" :key="item.value" :value="item.value"
                                          :label="item.label"></vxe-option>
                            </vxe-select>
                          </template>
                        </vxe-form-item>
                        <vxe-form-item span="6">
                          <template #default>
                            <vxe-button size="mini" status="primary" @click="gettestSql()">测试并生成字段</vxe-button>
                          </template>
                        </vxe-form-item>

                        <vxe-form-item title="" field="sqlSchema" span="24" :item-render="{}">
                          <template #default>
                            <div><span style="font-size: 1.5em">取数SQL</span></div>
                            <vxe-textarea v-model="form.ext.sqlSchema" placeholder="请输入SQL"
                                          :autosize="{minRows: 20, maxRows: 20}"></vxe-textarea>
                          </template>
                        </vxe-form-item>
                      </vxe-form>
                    </el-col>
                    <el-col :span="8">
                      <vxe-table
                          border
                          size="mini"
                          ref="sourceFieldsSql"
                          :height="windowHeight/2"
                          :row-config="{isHover: true}"
                          :edit-config="{trigger: 'click', mode: 'cell'}"
                          :data="form.sourceField">
                        <vxe-column type="seq" width="40"></vxe-column>
                        <vxe-column field="field" title="字段"></vxe-column>
                        <vxe-column field="fieldType" width="100" title="类型"
                                    :edit-render="{name:'$select',options:datatype}"></vxe-column>
                      </vxe-table>
                    </el-col>
                  </el-row>
                </el-tab-pane>
                <el-tab-pane label="目标字段设置" name="C" v-if="form.type==='C'">
                  <vxe-form :data="form" title-align="right" title-width="100" size="mini">
                    <vxe-form-item field="ext.targetType" :item-render="{defaultValue:''}" title="目标类型" span="6">
                      <template #default="{ data }">
                        <vxe-select v-model="data.ext.targetType" transfer>
                          <vxe-option value="api" label="API"></vxe-option>
                          <vxe-option value="dingtalk" label="钉钉"></vxe-option>
                          <vxe-option value="wxwork" label="企业微信"></vxe-option>
                          <vxe-option value="form" label="表单"></vxe-option>
                        </vxe-select>
                      </template>
                    </vxe-form-item>
                    <vxe-form-item field="fromDB" :item-render="{defaultValue:''}" title="来源数据库" span="6">
                      <template #default="{ data }">
                        <vxe-select v-model="data.fromDB" transfer>
                          <vxe-option v-for="item in DB" :key="item.value" :value="item.value"
                                      :label="item.label"></vxe-option>
                        </vxe-select>
                      </template>
                    </vxe-form-item>
                    <vxe-form-item span="6">
                      <template #default>
                        <vxe-button size="mini" status="primary" @click="gettestSql()">测试并生成字段</vxe-button>
                      </template>
                    </vxe-form-item>


                  </vxe-form>
                  <vxe-table
                      border
                      size="small"
                      ref="transferDatat"
                      :height="windowHeight/2+200"
                      auto-resize
                      :row-config="{isCurrent: true, isHover: true}"
                      :edit-config="{trigger: 'click', mode: 'cell'}"
                      :tree-config="{ rowField: 'name', parentField: 'pname',expandAll:true,transform: true}"
                      :data="form.sqlSchema">
                    <vxe-column type="seq" width="80"></vxe-column>
                    <vxe-column field="title" title="名称" tree-node></vxe-column>
                    <vxe-column field="name" title="来源字段"></vxe-column>
                    <vxe-column field="type" title="类型">
                      <template #default="{ row }">
                        <vxe-select v-model="row.type" placeholder="请选择类型" transfer>
                          <!--                            <vxe-option v-for="(item, index) in datatype" :key="index" :value="item.value" :label="item.label"  v-if="transferForm.sourceType===0" ></vxe-option>-->
                          <!--                            <vxe-option v-for="(item, index) in dingtypes" :key="index" :value="item.value" :label="item.label"  v-if="transferForm.sourceType===1" ></vxe-option>-->
                          <!--                            <vxe-option v-for="(item, index) in datatype" :key="index" :value="item.value" :label="item.label"  v-if="transferForm.sourceType===2" ></vxe-option>-->
                        </vxe-select>
                      </template>


                    </vxe-column>
                    <vxe-column field="field" title="接口字段"
                                :edit-render="{name: 'input', attrs: {type: 'text'}}"></vxe-column>
                    <vxe-column title="操作" width="100" show-overflow>
                      <template #default="{ row }">
                        <vxe-button size="small" content="操作">
                          <template #dropdowns>
                            <vxe-button type="text" content="添加同级"></vxe-button>
                            <vxe-button type="text" content="新增下级"></vxe-button>
                            <vxe-button type="text" content="删除字段"></vxe-button>
                          </template>
                        </vxe-button>
                      </template>
                    </vxe-column>
                  </vxe-table>
                </el-tab-pane>
                <el-tab-pane label="预警设置" name="D" v-if="form.type==='D'">

                  <vxe-form :data="form" title-align="right" title-width="100" size="mini">

                    <vxe-form-item title="来源类型" field="ext.type" span="24"
                                   :item-render="{name: '$radio', options:[{label:'表单',value:1},{label:'SQL',value:2}]}"
                                   title-overflow="ellipsis"></vxe-form-item>
                    <vxe-form-gather span="24" v-if="form.ext.type===1">
                    <vxe-form-item title="选择模板" field="ext.template" :item-render="{}" span="24">
                      <template #default="{ data }">
                        <el-select v-model="data.ext.template" filterable clearable placeholder="选择模板"
                                   @change="changetable">
                          <el-option
                              v-for="item in templates"
                              :key="item.id"
                              :label="item.title"
                              :value="item.code"/>
                        </el-select>
                      </template>
                    </vxe-form-item>
                    <vxe-form-item title="选择表" field="ext.table" :item-render="{}" span="24">
                      <template #default="{ data }">
                        <el-select v-model="data.ext.table" filterable clearable placeholder="选择表"
                                   @change="changefield">
                          <el-option
                              v-for="item in tables"
                              :key="item.tableID"
                              :label="item.tableDispName"
                              :value="item.tableName"
                          />
                        </el-select>
                      </template>
                    </vxe-form-item>
                    <vxe-form-item title="选择关键字段" field="ext.field" :item-render="{}" span="24">
                      <template #default="{ data }">
                        <el-select v-model="data.ext.field" filterable clearable placeholder="选择字段">
                          <el-option
                              v-for="item in fields"
                              :key="item.fieldID"
                              :label="item.fieldDispName"
                              :value="item.fieldName"
                          />
                        </el-select>
                      </template>
                    </vxe-form-item>
                    <vxe-form-item title="设置字段条件" field="ext.filter" :item-render="{}" span="24">
                      <template #default="{ data }">
                        <vxe-toolbar>
                          <template #buttons>
                            <vxe-button size="mini" icon="vxe-icon-square-plus" @click="insertEvent()">新增</vxe-button>
                          </template>
                        </vxe-toolbar>
                        <vxe-table
                            border
                            ref="yj"
                            show-overflow
                            :column-config="{resizable: true}"
                            :data="form.ext.filter"
                            :edit-config="{trigger: 'dblclick', mode: 'row'}">
                          <vxe-column type="seq" width="60"></vxe-column>
                          <vxe-column field="field" title="字段" :edit-render="{}">
                            <template #default="{ row }">
                              <el-select v-model="row.field"  size="small" filterable clearable placeholder="选择字段">
                                <el-option
                                    v-for="item in fields"
                                    :key="item.fieldID"
                                    :label="item.fieldDispName"
                                    :value="item.fieldName"
                                />
                              </el-select>
                            </template>
                          </vxe-column>
                          <vxe-column field="type" title="条件" :edit-render="{}">
                            <template #default="{ row }">
                              <el-select v-model="row.type" filterable clearable  size="small" placeholder="选择">
                                <el-option v-for="item in Filter"
                                           :key="item.value"
                                           :label="item.title"
                                           :value="item.type"/>
                              </el-select>
                            </template>
                          </vxe-column>
                          <vxe-column field="valuetype" title="值类型" :edit-render="{}">
                            <template #default="{ row }">
                              <el-select v-model="row.valuetype" filterable clearable placeholder="选择" size="small">
                                <el-option label="字段"   value="F"/>
                                <el-option label="自定义"   value="D"/>
                              </el-select>
                            </template>
                          </vxe-column>
                          <vxe-column field="value" title="值(字符串用'XXX')" :edit-render="{}">
                            <template #default="{ row }">
                              <vxe-input v-if="row.valuetype==='D'" v-model="row.value" type="text"  size="small"></vxe-input>
                              <el-select  v-else v-model="row.value" filterable clearable  size="small" placeholder="选择字段">
                                <el-option
                                    v-for="item in fields"
                                    :key="item.fieldID"
                                    :label="item.fieldDispName"
                                    :value="item.fieldName"
                                />
                              </el-select>
                            </template>
                          </vxe-column>
                          <vxe-column title="操作" :edit-render="{}">
                            <template #default="{ row }">
                              <vxe-button @click="deleteRowEvent(row)">删除</vxe-button>
                            </template>
                          </vxe-column>
                        </vxe-table>
                      </template>
                    </vxe-form-item>
                    <vxe-form-item title="提示消息" field="ext.msg" :item-render="{}" span="24">
                      <template #default="{ data }">
                        <vxe-input  v-model="data.ext.msg" type="text"  size="small"></vxe-input>
                        <el-button-group class="ml-4" v-for="item in fields">
                          <el-button type="primary" size="small" @click="data.ext.msg=data.ext.msg+='{#.'+item.fieldName+'}'">{{item.fieldDispName}} </el-button>                 </el-button-group>
                      </template>
                    </vxe-form-item>

                      </vxe-form-gather>
                    <vxe-form-gather span="24" v-if="form.ext.type===2">
                      <vxe-form-item field="ext.fromDB" :item-render="{defaultValue:''}" title="来源数据库" span="10">
                        <template #default="{ data }">
                          <vxe-select v-model="data.ext.fromDB" transfer>
                            <vxe-option v-for="item in DB" :key="item.value" :value="item.value"
                                        :label="item.label"></vxe-option>
                          </vxe-select>
                        </template>
                      </vxe-form-item>
                      <vxe-form-item span="6">
                        <template #default>
                          <vxe-button size="mini" status="primary" @click="gettestSql()">测试并生成字段</vxe-button>
                        </template>
                      </vxe-form-item>

                      <vxe-form-item title="" field="sqlSchema" span="24" :item-render="{}">
                        <template #default>
                          <div><span style="font-size: 1.5em">条件SQL</span><span>有数据则提示!</span></div>
                          <vxe-textarea v-model="form.ext.sqlSchema" placeholder="请输入SQL" :autosize="{minRows:5 , maxRows: 5}"></vxe-textarea>
                        </template>
                      </vxe-form-item>
                      <vxe-form-item title="提示消息" field="ext.msg" :item-render="{name:'input'}" span="24"></vxe-form-item>
                      </vxe-form-gather>
                  </vxe-form>

                </el-tab-pane>
                <el-tab-pane label="通知类型" name="D1" v-if="form.type==='D'">

                  <vxe-form :data="form" title-align="right" title-width="100" size="mini">

                    <vxe-form-item title="通知类型" field="ext.msgType" span="24" :item-render="{}" >
                      <template #default="{ data }">
                        <vxe-select v-model="data.ext.msgType" placeholder="请选择类型" multiple clearable transfer>
                          <vxe-option value="message" label="系统消息"></vxe-option>
                          <vxe-option value="dingtalk" label="钉钉"></vxe-option>
                          <vxe-option value="wxwork" label="企业微信" disabled></vxe-option>
                          <vxe-option value="email" label="邮件" disabled></vxe-option>
                          <vxe-option value="sms" label="短信" disabled></vxe-option>
                        </vxe-select>
                      </template>
                    </vxe-form-item>
                    <vxe-form-item field="ext.times" title="接收人类型" :span="24" :item-render="{}">
                      <template #default="{ data }">
                        <vxe-radio-group v-model="data.ext.times">
                          <vxe-radio :label="1" content="单次"></vxe-radio>
                          <vxe-radio :label="2" content="多次"></vxe-radio>
                        </vxe-radio-group>
                      </template>
                    </vxe-form-item>
                    <vxe-form-item field="ext.userType" title="接收人类型" :span="24" :item-render="{}">
                      <template #default="{ data }">
                        <vxe-radio-group v-model="data.ext.userType">
                          <vxe-radio label="sys" content="系统用户"></vxe-radio>
                          <vxe-radio label="form" content="表单用户"></vxe-radio>
                          <vxe-radio label="roles" content="系统角色"></vxe-radio>
                        </vxe-radio-group>
                      </template>
                    </vxe-form-item>

                    <vxe-form-item title="接收人字段" field="ext.userField" span="24" :item-render="{}" title-overflow="title"  v-if="form.ext.userType==='form'">
                      <template #default="{data}">
                        <vxe-select v-model="data.ext.userField" placeholder="请选择字段" clearable transfer>
                            <vxe-option v-for="(item,index) in fields" :key="index" :value="item.fieldName" :label="item.fieldDispName"></vxe-option>
                        </vxe-select>
                      </template>
                    </vxe-form-item>
                    <vxe-form-item title="接收人字段类型" field="ext.userFieldType" span="24" :item-render="{}" title-overflow="title" v-if="form.ext.userType==='form'" >
                      <template #default="{ data }">
                        <vxe-select v-model="data.ext.userFieldType" placeholder="请选择类型" clearable transfer >
                          <vxe-option value="userid" label="用户ID"></vxe-option>
                          <vxe-option value="dingtalk" label="钉钉用户"></vxe-option>
                          <vxe-option value="wxwork" label="企业微信"></vxe-option>
                          <vxe-option value="U8" label="U8用户名"></vxe-option>
                        </vxe-select>
                      </template>
                    </vxe-form-item>
                    <vxe-form-item title="接收角色" field="ext.userid" :item-render="{}" span="24" v-if="form.ext.userType==='roles'" >
                      <template #default="{ data }">
                        <vxe-select v-model="data.ext['roles']" placeholder="选择角色" clearable transfer>
                          <vxe-option v-for="(item,index) in rotData" :value="item.id" :label="item.name"></vxe-option>
                        </vxe-select>
                      </template>
                    </vxe-form-item>
                  <vxe-form-item title="接收人员" field="ext.userid" :item-render="{}" span="24" v-if="form.ext.userType==='sys'" >
                      <template #default="{ data }">
                        <vxe-select v-model="data.ext.userid" placeholder="请选择人员" multiple clearable transfer>
                          <vxe-option v-for="item in users" :key="item.id" :value="item.id" :label="item.userName"></vxe-option>
                        </vxe-select>
                      </template>
                    </vxe-form-item>
                      <vxe-form-item title="发送后更新标识字段" field="ext.UpField" span="12" :item-render="{}"  >
                          <template #default="{data}">
                              <vxe-select v-model="data.ext.UpField" placeholder="请选择字段" clearable transfer>
                                  <vxe-option v-for="(item,index) in fields" :key="index" :value="item.fieldName" :label="item.fieldDispName"></vxe-option>
                              </vxe-select>
                          </template>
                      </vxe-form-item>
                      <vxe-form-item title="更新值(文本格式为'XXX')" field="ext.UpValue" span="12" :item-render="{}"  >
                      <template #default="{data}">
                          <vxe-input v-model="data.ext.UpValue" placeholder="更新值"></vxe-input>
                      </template>
                  </vxe-form-item>
                  </vxe-form>
                </el-tab-pane>
              </el-tabs>

            </div>
          </el-main>
          <el-footer>
            <vxe-form :data="form" @submit="onSubmit">
              <vxe-form-item align="center" title-align="left" :span="24">
                <template #default>
                  <vxe-button type="submit">提交</vxe-button>
                  <vxe-button type="reset">重置</vxe-button>
                  <vxe-button status="primary" @click="OperationTask(1)">启动</vxe-button>
                  <vxe-button status="primary" @click="OperationTask(0)">停止</vxe-button>
                </template>
              </vxe-form-item>
            </vxe-form>


          </el-footer>
        </el-container>
      </el-container>
    </el-container>
  </div>
</template>

<script>
import {defineComponent, onBeforeMount,onMounted, reactive, toRefs,ref} from 'vue'
import {listLkOdatabase} from '/@/api/linkoo/form/lkDataRules'
import {taskEdit, taskList, taskOperation, taskTestSql,taskTest} from '/@/api/linkoo/task/index'
import {getDatasource} from "/@/api/linkoo/templates";
import XEUtils from 'xe-utils'
import {ElMessage} from 'element-plus'
import {getUserList} from "/@/api/system/user";
import { getRoleList} from "/@/api/system/role";
export default defineComponent({
  name: "cron",
  setup() {
    const taskListGrid = reactive(null)
    const yj = ref(null)

    let state = reactive({
      windowHeight: document.documentElement.clientHeight,
      ToFields: [],
      activeName: 'A',
      templates: [],
      tables: [],
      fields: [],
      users: [],
      DB: [{label: '本地数据库', value: ''}],
      datatype: [{label: '文本', value: 'Text'}, {label: '数字', value: 'Number'}, {
        label: '日期',
        value: 'Date'
      }, {label: '表格', value: 'Table'}],
      Filter: [{type: '=', title: '等于'}, {type: '<>', title: '不等于'}, {type: '<', title: '小于'},
        {type: '<=',title: '小于等于'}, {type: '>', title: '大于'}, {type: '>=', title: '大于等于'},
        {type: 'like', title: '包含'}, {type: 'in',title: '在列表中'}, {type: 'is null',title: '为空'}, {type: 'is not null',title: '不为空'}],

      form: {id: 0, ext: {filter: [],userType:'sys'}, type: 'A'},
    })
    const gridOptions1 = reactive({
      border: true,
      height: document.documentElement.clientHeight - 200,
      align: null,
      rowConfig: {isCurrent: true, isHover: true},
      columnConfig: {
        resizable: true
      },
      columns: [
        {type: 'seq', width: 50},
        {field: 'name', width: 200, title: '任务名称'},
        {field: 'isActive', title: '启用', width: 70, showHeaderOverflow: true},
      ],
      toolbarConfig: {
        slots: {
          buttons: 'toolbar_buttons'
        }
      },
      data: []
    })
    let rotData = ref([])
    onMounted(()=>{
      getRoleList().then((res)=>{
        rotData.value=res.data.list
        console.log(res);
      })
    })
    const getDatabase = () => {
      listLkOdatabase({pageNum: 1, pageSize: 1000}).then(res => {
        if (res.data.list) {
          res.data.list.forEach(row => {
            state.DB.push({label: row['oDataName'] + ' ' + row['memo'], value: row['oDataName']})
          })
        }

      })
      getDatasource().then(res => {
        state.templates = res.data.list.find(item => item.id === 1).children

      })
      getUserList({pageNum: 1, pageSize: 1000,}).then(res => {
        state.users = res.data.userList.map(row=>{
          row.id=XEUtils.toString(row.id)
          return row
        })
      })
    }
    const getTaskList = () => {
      taskList({pageNum: 1, pageSize: 1000}).then(res => {
        if (res.data) {
          gridOptions1.data = res.data
        }
      })
    }
    const newtask = () => {
      XEUtils.objectEach(state.form, (val, key) => {
        state.form[key] = null
      })

      state.form.id = 0
      state.form.ext = {}
    }
    const onSubmit = () => {
      if(state.form.ext.type===1){
        state.form.ext.filter=yj.value.getTableData().fullData
      }
      taskEdit(state.form).then(res => {
        if (res.code === 0) {
          ElMessage.success("任务保存成功!")
        } else {
          ElMessage.error("任务保存失败:" + res.message)
        }
        getTaskList()
      })
    }
    const changetable = (value) => {
      console.log(state.templates,XEUtils.find(state.templates, item => item.code === value),value);
      if(state.templates.length>0){
        state.tables = XEUtils.find(state.templates, item => item.code === value).children
      }
      
    }
    const changefield = (value) => {
      if(state.tables.length==0){
        return
      }
      state.fields = XEUtils.find(state.tables, item => item.tableName === value).Fields
    }
    const gettestSql = () => {
      taskTestSql({id: state.form.id}).then(res => {
        console.log(res)
      })
    }
    const dotaskTest = () => {
      taskTest( state.form.id).then(res => {
        console.log(res)
      })
    }
    const OperationTask = (status) => {
      if (state.form.id === 0) {
        ElMessage.error("请先选择任务")
        return
      }
      taskOperation({id: state.form.id, status: status}).then(res => {
        console.log(res)
      })
    }
    const remove = () => {
      console.log('submit!')
    }
    const insertEvent = async () => {
      const $table = yj.value
      const record = {field: '', type: '', value: ''}
      const {row: newRow} = await $table.insert(record)
      await $table.setEditCell(newRow, 'name')
    }
    const deleteRowEvent = (row) => {
      const $table = yj.value
      $table.remove(row)
    }

    const currentChangeEvent = ({row}) => {
      const data = XEUtils.clone(row, true)
      data['ext'] = XEUtils.toStringJSON(data['ext'])
      state.form = data
      state.activeName=state.form.type
      if (state.form.type==='D'){
        changetable(state.form.ext.template)
        changefield(state.form.ext.table)
      }
    }
    onBeforeMount(() => {
      getDatabase()
      getTaskList()
    })

    return {
      ...toRefs(state),
      gridOptions1,rotData,
      yj,
      onSubmit,
      gettestSql,
      newtask,
      getTaskList,
      currentChangeEvent,
      remove,
      changetable, changefield, insertEvent, deleteRowEvent,dotaskTest,
      OperationTask,
      taskListGrid
    }
  }
})
</script>

<style scoped>

</style>